$(function(){
	var vaccineId = ym.getQueryStringByName('vaccineId');
	var vaccineTypeId = ym.getQueryStringByName('vaccineTypeId');
	var parentId = ym.getQueryStringByName('parentId');
	var childId = ym.getQueryStringByName('childId');
	/*疫苗说明*/
	ym.ajax({
		url:'/vaccine/queryVaccine',
		param:{ vaccineTypeId:vaccineTypeId},
		success:function(data){
			if(data.res ==1){
				var zhi = data.obj.results[0];
				$('.jzxg').text(zhi.vaccineResult);
				$('.jzbw').text(zhi.vaccinePart);
				$('.jzjj').text(zhi.vaccineTaboo);
				$('.zysx').text(zhi.announcements);
				$('.lnfy').text(zhi.untowardEffect);
				$('h4').text(zhi.vaccineTypeName);
			}else{console.log("数据获取失败！")}
		}
	});
	/*剂次*/
	ym.ajax({
		url:'/vaccine/queryVaccineHistoryPlan',
		param:{ 
			vaccineTypeId:vaccineTypeId,
			childrenId:childId,
		},
		success:function(data){
			if(data.res ==1){
				console.log(data);
				var html = "";
				$('.two>ul').html("");
				if(data.obj.length > 0){
					var num = 0;
					for(var i=0;i<data.obj.length;i++){
						num++;
						html += '<li class="list list backwhite">';
						html += '<div class="displayfx package">';
						if(data.obj[i].vaccinationTime == ""){
							html += '<p class="w5 am-text-center padding colorb6bcce"><i class="serials">'+num+'</i></p>';
							html += '<span class="w20 padding colorb6bcce">'+data.obj[i].age+'</span>';
							html += '<time class="w65 padding colorb6bcce">'+data.obj[i].vaccineTypeName+'</time>';
							html += '<div class="w20 textright padding">';
							html += '<span class="colorb6bcce">未接种</span>';
						}else{
							html += '<p class="w5 am-text-center padding"><i class="serial">'+num+'</i></p>';
							html += '<span class="w20 padding">'+data.obj[i].age+'</span>';
							html += '<time class="w65 padding">'+data.obj[i].vaccinationTime+'</time>';
							html += '<div class="w20 textright padding">';
							html += '<span>已接种</span>';
						}
						html += '</div>';
						html += '</div>';
						html += '</li>';
					}
					$('.two>ol').append(html);
				}else{
					html += '<li class="color46c8ff list backwhite am-text-center"><img style="height:150px" src="../img/no.jpg"></li>';
					$('.two>ol').append(html);
				}
				
			}else{console.log("数据获取失败！")}
		}
	});
	
	/*相关疫苗*/
	var vaccines = [];
	vaccines.push(vaccineId);
	$('.three').html("");
	ym.ajax({
		url:'/vaccine/queryVaccineRelevanceDetail',
		param:{ vaccines:vaccines},
		success:function(data){
			if(data.res ==1){
				var html = "";
				if(data.obj.length > 0){
					for(var i=0;i<data.obj.length;i++){
						html += '<div class="backwhite  zjyy_div am-padding-sm zifei">';
						html += '<div class="am-block">';
						html += '<b class="font15 am-align-left am-margin-0 am-padding-left-xs">'+data.obj[i].vaccineTypeName+'</b>';
						html += '<br>';
						html += '<span class="colorb6bcce font13 am-padding-left-xs">'+data.obj[i].vaccineTypeName+'</span>';
						
						html += '</div>';
						html += '</div>';
						$('.three').append(html);
					}
				}else{
					html += '<div class="backwhite zjyy_div zifei"><img style="height:150px" src="../img/no.jpg"></div>';
					$('.three').append(html);
				}
				
			}else{console.log("数据获取失败！")}
		}
	});
})
